// 封装对本地存储的操作
export const getItem = (key) => {
    let data
    try {
        data = JSON.parse(localStorage.getItem(key))
    } catch (error) {
        data = localStorage.getItem(key)
    }
    return data
}
export const setItem = (key, value) => {
    if (typeof value === 'object') {
        localStorage.setItem(key, JSON.stringify(value))
    } else {
        localStorage.setItem(key, value)
    }
}
export const removeItem = (key) => {
    localStorage.removeItem(key)
}